#include <iostream>
#include <string>
#include <ctime>
#include "swarmSocketServer.h"
#include "swarmSocketClient.h"

using namespace std;

int main(int argc,char* argv[])
{
	if(argc != 2)
	{
		return 1;
	}
	time_t begin, now;
	time(&begin);
	swarmSocketClient client(argv[1], 5555);
	int nbytes = client.initclient();
	if( nbytes < 0)
	{
		//perror("connect");
		cout << nbytes << endl;
		return 1;
	}
	string s;
	cin >> s;
	while(s != "q")
	{
		client.writeMessage(s.c_str(), s.size());
		cin >> s;
	}
	return 0;
}
